import db from "../utils/db"

export function getAllMeasureData() {
  return db.measuredata.toArray();
}

export function getMeasureDataById(id) {
  return db.measuredata.get(id);

}

export function addOrUpdateMeasureData(item) {
  if (item.id === undefined || item.id === "" || item.id === null) {
    delete item["id"]
    db.measuredata.add(item);
  } else {
    db.measuredata.put(item);
  }
}



export function deleteMeasureDataById(id) {
   db.measuredata.delete(id);
}

export function deleteMeasureDataByConditionEqual(condition, value) {
  return db.measuredata.where(condition).equals(value).delete();
}
